package Service.impl;

import Dao.impl.ProDaoimpl;
import Service.ProService;
import pojo.Pro;
import java.util.List;

/**
 * @author LiangHaiBo
 * @version 1.0
 * @date 2021.8.27 下午 16:42
 */
public class ProServiceimpl implements ProService {

    @Override
    public List<Pro> getAllProduct() {
        ProDaoimpl proDaoimpl = new ProDaoimpl();
        List<Pro> list = proDaoimpl.selectProductAll();
        if(list != null){
            return list;
        }
        return null;
    }

    @Override
    public int deleteGet(int id) {
        ProDaoimpl proDaoimpl = new ProDaoimpl();
        return proDaoimpl.delete(id);
    }

    @Override
    public int addGet(Pro pro) {
        ProDaoimpl proDaoimpl = new ProDaoimpl();
        return  proDaoimpl.add(pro);
    }

    @Override
    public int deleteGet(String pname) {
        ProDaoimpl proDaoimpl = new ProDaoimpl();
        return  proDaoimpl.delete(pname);
    }

    @Override
    public int updateGet(Pro pro) {
        ProDaoimpl proDaoimpl = new ProDaoimpl();
        return proDaoimpl.update(pro);
    }
}
